/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
var request = require('request');

module.exports = function(source, options) {

  var option = {
    url: 'http://www.q8daili.com/wait.php',
    method: 'POST',
    form: {
      u: 'http://static4j.sturgeon.mopaas.com/monitor.html',
      type: 0
    },
    timeout : 20000,
    rejectUnauthorized : false,
    headers: {
        'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:30.0) Gecko/20100101 Firefox/30.0',
        'Referer': 'http://www.q8daili.com/wait.php'
    }
  }

  var callback = function(error, response, body) {
    if (!error && response.statusCode == 200) {
      console.log(body);
    } else {
      console.log(error);
      console.log('POST request failed!');
    }
  };

  return function(req, res, next) {
    option.url = 'http://blackcheets.com/proxies/includes/process.php?action=update';
    request(option, callback);
    option.url = 'http://www.tntpvp.com/proxy/includes/process.php?action=update';
    request(option, callback);
    option.url = 'https://beanonymouse.com/includes/process.php?action=update';
    request(option, callback);
    option.url = 'https://beanonymouse.com/includes/process.php?action=update';
    request(option, callback);
    option.url = 'http://www.baidu.com';
    request(option, callback);
    next();
  };
};